// Count Charecters,Words,Vowels,Consonants,Sentences
// Version 1.0
// Date 21:06 08/10/2016
// By Ben a.k.a DreamVB

#include <iostream>

using namespace std;
using std::cout;
using std::endl;

int main(int argc, char *argv[]){
	string sWord = "";
	string sVowels = "aeiou";
	string s0 = "This programs counts letters words.";

	int i = 0;
	int c = 0;
	int v = 0;
	int w = 0;
	int s = 0;

	//Append space at end to catch the last word.
	if (s0[s0.length() - 1] != '\ '){
		s0 += " ";
	}

	while (i < s0.length()){
		if (s0[i] == '\ '){
			if (sWord.length()>0){
				if (sWord.find('.') != string::npos){
					s++;
				}
			}
			w++;
			sWord.clear();
		}
		else{

			if (sVowels.find(tolower(s0[i]))!=string::npos){
				v++;
			}
			else{
				if (isalpha(s0[i])){
					c++;
				}
			}

			sWord += s0[i];
		}
		i++;
	}
	i--;
	cout << "Source     : " << s0.c_str() << endl;
	cout << "Charecter  : " << i << endl;
	cout << "Words      : " << w << endl;
	cout << "Vowels     : " << v << endl;
	cout << "Consonants : " << c << endl;
	cout << "Sentences  : " << s<<endl;

	system("pause");
	return 0;
}